package com.onlyyou.pictureserver.service.Impl;

import com.onlyyou.pictureserver.entity.Stock;
import com.onlyyou.pictureserver.mapper.StockMapper;
import com.onlyyou.pictureserver.service.ImageUrl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author: 小野
 * @Date: 2020/1/17 17:34
 */
@Service
public class ImageUrlImpl implements ImageUrl {

    @Autowired
    private StockMapper stockMapper;

    @Override
    @Transactional
    public Stock uploadUrl(Long id, String url) {
        Stock stock = stockMapper.findById(id);
        if (null==stock)
            return null;
        stockMapper.update(id);
        Stock finshStock = stockMapper.findById(id);
        return finshStock;
    }
}
